//@author A0084176Y
package Main;

import java.util.*;

public class Undo {
	private Stack<DataForUndo> undostack = new Stack<DataForUndo>();
	
	public Undo(){
		undostack=new Stack<DataForUndo>();
	}
	public void addUndo(String name, String t){
		DataForUndo data = new DataForUndo(name,t);
		undostack.push(data);
	}
	
	public void addUndo(String oldn, String newn, String t){
		DataForUndo data = new DataForUndo (oldn, newn, t);
		undostack.push(data);
	}
	
	public void addUndo(Item i, String t){
		DataForUndo data=new DataForUndo(i, t);
		undostack.push(data);
	}
	
	public void addUndo(Item i, String t, int ind){
		DataForUndo data = new DataForUndo(i, t, ind);
		undostack.push(data);
	}
	
	public void addUndo(Item old, Item _new, String t){
		DataForUndo data=new DataForUndo(old, _new, t);
		undostack.push(data);
	}
	
	
	public DataForUndo UndoAction(){
		return (undostack.pop());	
	}
	
	public boolean check(){
		return undostack.isEmpty();
	}

}
